const install = (Vue, vm) => {
	const isLogin = () => {
		// 获取登录之前的页面
		const page = getCurrentPages().pop()
		// console.log(page)
		uni.setStorageSync('backUrl', {
			route: page.route,
			options: page.options
		})
		const token = vm.$store.state.vuex_token
		if (!token) {
			uni.$u.toast('请先登录')
			setTimeout(() => {
				uni.$u.route({
					type: 'redirect',
					url: 'pages/auth/login'
				})
			}, 1500)
			return false
		}
		return true
	}
	vm.$u.utils = {
		isLogin
	}
}

export default {
	install
}